import request from '@/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/blade-api/chat/knowledge-bases',
    method: 'get',
    params: {
      page: current,
      limit: size,
      ...params,
    },
  });
};

export const getListByDB = (current, size, params) => {
  return request({
    url: '/blade-api/chat/knowledge-bases-bydb',
    method: 'get',
    params: {
      page: current,
      limit: size,
      ...params,
    },
  });
};
export const remove = dataset_id => {
  return request({
    url: `/blade-api/chat/knowledge-base/${dataset_id}`,
    method: 'delete',
  });
};
export const removeFile = (datasetId, documentId) => {
  return request({
    url: `/blade-api/chat/knowledge-base/${datasetId}/document/${documentId}`,
    method: 'delete',
  });
};
export const add = name => {
  return request({
    url: '/blade-api/chat/knowledge-base',
    method: 'post',
    params: {
      name,
    },
  });
};
export const getFileList = (datasetId, current, size, params) => {
  return request({
    url: `/blade-api/chat/knowledge-base/${datasetId}/documents`,
    method: 'get',
    params: {
      datasetId: datasetId,
      page: current,
      limit: size,
    },
  });
};
export const getFileBlockData = (datasetId, documentId) => {
  return request({
    url: `/blade-api/chat/${datasetId}/documents/${documentId}/blocks`,
    method: 'get',
  });
};
